package net.oschina.thrift.client.support.pool.factory;

import net.oschina.thrift.client.support.config.TSConfig;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

/**
 * 使用TFrameTransport
 *
 * @author dw_xiajiqiu1
 * @time 2017/7/28 11:06
 */
public class TFrameTransportTClientPooledObjectFactory extends TBinaryProtocolTClientPooledObjectFactory {

    @Override
    protected TTransport wrapTSocketTransport(TSConfig config, TSocket socket) {
        TTransport transport = new TFramedTransport(socket);
        logger.info("Create TFramedTransport successfully! " + config.getHost() + ":" + config.getPort() + ":" + config.getTimeout() + ":" + config.getWeight());
        return transport;
    }
}
